package com.frejoys.dao.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.frejoys.dao.entity.User;
import com.frejoys.dao.entity.UserCode;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface UserCodeMapper extends BaseMapper<UserCode> {

    //获取用户邀请码
    @Select("select code from j_user_code where user_id=#{userId} limit 1")
    String codeByUserId(Long userId);

    //根据code获取用户id
    @Select("select user_id from j_user_code where code=#{code} limit 1")
    Long userIdByCode(String code);

    //获取用户邀请码
    List<UserCode> getUserCodeList(@Param("userIds") List<Long> userIds);
}
